<script>
	import $common from './common/common';
	export default {
		onLaunch: async function() {

			let save_time = 0;		
			
			this.goeasy.connect({
				onSuccess:  () => {  //连接成功
					console.info('websocket连接成功')
				},
				onFailed: (error) => { //连接失败
					console.error('websocket连接失败')
				},
				onProgress:(attempts) => { //连接或自动重连中
				  console.log("GoEasy is connecting", attempts);
				}
			});
			
			
			if(uni.getStorageSync('GAME_TOKEN')){
				uni.reLaunch({
					url:'/pages/loading/loading'
				})
			}
			
		},
		onShow: function() {
			console.log('App Show')
			this.globalData.appVisibleState = 'onShow'
		},
		onHide: function() {
			console.log('App Hide')
			this.globalData.appVisibleState = 'onHide'
			//this.$common.save_game()
		},
		globalData : {
			GAME_DATA:{},
			equip_name : ['武器','衣服','手镯','戒指','头盔','项链','腰带','鞋子']
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	*{
		box-sizing: border-box;
	}
	page{
		font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
		color: #abb2bf !important;
		font-size: 14px;
		background-color: #282c35;
		overflow-y: overlay;
	}
	
	/* 滚动条整体样式 */
	::-webkit-scrollbar{
	  width: 4px;
	  height:2px;
	}
	/* 滚动条内嵌滑块 */
	::-webkit-scrollbar-thumb{
	  border-radius: 10px;
	  background: rgba(0,0,0,0.2);
	  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
	  -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
	}
	/* 滚动条边角 */
	::-webkit-scrollbar-corner{
	  border-radius: 0;
	  background: rgba(0,0,0,0.1);
	  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
	  -webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.2);
	}
	
	
	/*颜色变量*/
	:root{
		--color-default:#abb2bf;
		--color-green:#4cd964;
		--color-blue:#0099cc;
		--color-yellow:#f0ad4e;
		--color-red:#ca352c;
		--color-red2:#dd524d;
		--color-purple:#c678dd;
	}
	
	/*品质变量*/
	:root {
		--qlty-1: #abb2bf; //普通
		--qlty-2: #0099cc; //优秀
		--qlty-3: #f0ad4e; //传说
		--qlty-4: #dd524d; //史诗
	}
	
	@font-face{
	    font-family: 'demonized';
	    src:url('@/static/fonts/demonized.ttf');
	}
	
	
	/*
		整体checklist主题
	 */
	.uni-data-checklist .checklist-group .checklist-box .checkbox__inner {
		background-color: #21252b !important;
		border: 1px solid #000 !important;
		border-radius: 0 !important;
	}
	
	
	
	/* 回收面板check主题 */
	.retrieve-config-box{
		.qlty{
			.checklist-box{
				@for $i from 1 through 4{
					&:nth-child(#{$i}){
						.checklist-text{
							color:var(--qlty-#{$i}) !important
						}
					}
				}
			}
		}
	}
	
	.hr {
		border: 0;
		padding-top: 1px;
		background: linear-gradient(to right, transparent, #000000, transparent);
	}
	
	.game-input-box{
		border: 1px solid #000000;
		background-color: $game-color-2;
		height:45px;
		font-size: 14px;
		padding:0 20px;
		margin-bottom:20px;
		border-radius: 4px;
		overflow: hidden;
	}
	
	.need-resource{
		border: 1px solid #000;
		.need-resource-hd{
			height:30px;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: $game-color-2;
			border-bottom: 1px solid #000;
		}
		.need-resource-bd{
			.need-resource-item{
				height:30px;
				border-bottom: 1px solid #000;
				display: flex;
				align-items: center;
				&:last-child{
					border-bottom: none;
				}
				&:nth-child(2n){
					background-color: $game-color-2;
				}
				.label{
					width:80px;
					border-right: 1px solid #000;
					height:30px;
					display: flex;
					justify-content: center;
					align-items: center;
				}
				.value{
					padding-left:10px;
					&.not-enough{
						color:var(--color-red2)
					}
				}
			}
		}
	}
	
	
	/*
		popup 样式
	 */
	.popup{
		border: 1px solid #000;
		
		display: flex;
		flex-direction: column;
		border-radius: 4px;
		overflow: hidden;
		.hd{
			background-color: #21252b;
			height:34px;
			border-bottom: 1px solid #000;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-shrink: 0;
		}
		.bd{
			background-color: #282c35;
			flex:1;
			display: flex;
			
		}
	}
	

	.uni-table{
		border-radius: 0 !important;
		.uni-table-tr{
			background-color: $game-color-2;
		}
		.table--border{
			border: 1px solid #000 !important;
		}
	}
	
	

</style>
